﻿/**********************************************************************************
 * Project Name     :   
 * Remarks          :  
 * Interface Name   :  IRepository 
 * Version          :  v1.0.0.0 
 * Author           :  Joey Liang 
 * Description      :  
 * Created Time     :  2013/10/31 22:44:22
 * Update Man       :  Joey Liang
 * Update Time      :  2013/10/31 22:44:22
************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace IdleTest.EFAndMVCDemo.IRepositories
{
    public interface IRepository<TEntity, TKey> where TEntity : class
    {
        IEnumerable<TEntity> Get(
            Expression<Func<TEntity, bool>> filter = null,
            Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
            string includeProperties = "");

        TEntity GetSingle(TKey id);

        void Insert(TEntity entity);

        void Update(TEntity entityToUpdate);

        void Delete(TKey id);

        void Delete(TEntity entityToDelete);
    }
}
